package com.qys.livesMall.event.listener;

import com.qys.livesMall.app.user.event.ChannelEditEvent;
import com.qys.livesMall.app.user.model.dto.sys.ChannelEditShopDTO;
import com.qys.livesMall.shop.service.ShopStatisticsTeamService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;

@Slf4j
@RequiredArgsConstructor
public class ChannelEditListener {

    private final ShopStatisticsTeamService shopStatisticsTeamService;
    @Async
    @Order
    @EventListener(ChannelEditEvent.class)
    public void channelEdit(ChannelEditEvent channelEditEvent){
        ChannelEditShopDTO channelEditShopDTO= (ChannelEditShopDTO) channelEditEvent.getSource();
        shopStatisticsTeamService.updateShopExc(channelEditShopDTO.getShopIds());
    }
}
